import db from "../db";

export default defineEventHandler(async (event) => {
  try {
    const [rows] = await db.query(`SELECT h_id,date,content,create_time,update_time FROM company_history order by date desc`);
    return {
      code: 1,
      message: "成功",
      data: rows,
    };
  } catch (error) {
    console.error(error);
    return {
      code: 500,
      message: "服务器错误",
      data: null,
    };
  }
});
